package com.webbei.Backstage.action;

import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
import com.webbei.Backstage.service.BackstateSer;
import com.webbei.HAO.service.ChSer;
import com.webbei.custom.service.CustomSer;
import com.webbei.pojo.Products;
import com.webbei.util.VelocityUtil;


public class HtmlJson extends ActionSupport{
	private BackstateSer bao;
	private ChSer ser;
	private CustomSer cs;
	private int productId;
	private String msg;
	
	public String execute(){
		System.out.println("productId:"+productId);
		if(productId!=0){
		 VelocityUtil.productHtml(productId, ser, cs,bao);
		}else{
			List<Products> ps = bao.getAllProducts();
			for(Products p:ps){
				VelocityUtil.productHtml(p.getProductId(), ser, cs,bao);
			}
		}
		
		 msg = "success";
		return "success";
	}

	public int getProductId() {
		return productId;
	}

	public void setProductId(int productId) {
		this.productId = productId;
	}

	public void setBao(BackstateSer bao) {
		this.bao = bao;
	}

	public void setSer(ChSer ser) {
		this.ser = ser;
	}

	public void setCs(CustomSer cs) {
		this.cs = cs;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

}
